﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArticleManager.DataClasses
{
    public class Article
    {
        private int article_id;
        private string title;
        private string reviewers;
        private string publishers;
        private string translators;
        private string text;
        private ArticleKeysCollection keyList;
        private ArticleAuthorsCollection authorList;
  
		
        public Article()
		{
            this.article_id = 0;
            this.title = string.Empty;
            this.reviewers = string.Empty;
            this.publishers = string.Empty;
            this.translators=string.Empty;
            this.text = string.Empty;
            keyList = new ArticleKeysCollection();
            authorList = new ArticleAuthorsCollection();
            keyList.Clear();
            authorList.Clear();
		}


        public Article(int id, string title, string reviewers,
                    string publishers, string translators, string text, ArticleKeysCollection keyList,
            ArticleAuthorsCollection authorsList)
        {
            this.article_id = id;
            this.title = title;
            this.reviewers = reviewers;
            this.publishers = publishers;
            this.translators = translators;
            this.text = text;
            this.keyList = keyList;
            this.authorList = authorsList;
        }


        #region propertiese
        public int ArticleId
        {
            get
            {
                return this.article_id;
            }
            set
            {
                this.article_id = value;
            }
        }

        public ArticleKeysCollection KeywordList
        {
            get
            {
                return this.keyList;
            }
            set
            {
                this.keyList = value;
            }
        }

        public ArticleAuthorsCollection AuthorsList
        {
            get
            {
                return this.authorList;
            }
            set
            {
                this.authorList = value;
            }
        }

        public string Title
        {
            get
            {
                return this.title;
            }
            set
            {
                this.title = value;
            }
        }

        public string Text
        {
            get
            {
                return this.text;
            }
            set
            {
                this.text = value;
            }
        }

        public string Reviewers
        {
            get
            {
                return this.reviewers;
            }
            set
            {
                this.reviewers = value;
            }
        }

        public string Publishers
        {
            get
            {
                return this.publishers;
            }
            set
            {
                this.publishers = value;
            }
        }


        public string Translators
        {
            get
            {
                return this.translators;
            }
            set
            {
                this.translators = value;
            }
        }

        #endregion

        public override string ToString()
        {
            return this.title;
        }
        public class Properties
        {
            public const string ArtcileId = "article_id";
            public const string Title = "title";
            public const string Reviewers = "reviewers";
            public const string Publishers = "publishers";
            public const string Translator = "translator";
            public const string Text = "atext";
        }

    }



    public class ArticleCollection : System.Collections.CollectionBase
    {
        public int Add(Article value)
        {
            return base.List.Add(value as object);
        }

        public void Remove(Article value)
        {
            base.List.Remove(value as object);
        }

        public void Insert(int index,Article value)
        {
            base.List.Insert(index,value as object);
        }

        public bool Contains(Article value)
        {
            return base.List.Contains(value as object);
        }

        public Article this[int index]
        {
            get { return base.List[index] as Article; }
        }
    }
}
